import type { UserInterface } from '@/api/user';
import { defineStore } from 'pinia';
import { parse, stringify } from 'zipson/lib';

export const useUserStore = defineStore(
  'user',
  () => {
    const user = ref({} as UserInterface);
    return {
      user,
    };
  },
  {
    persist: {
      storage: sessionStorage,
      serializer: {
        deserialize: parse,
        serialize: stringify,
      },
    },
  },
);
